<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of ActiveRecord
 *
 * @author nnguyen60
 */
abstract class ActiveRecord extends CActiveRecord{
    //put your code here
    protected function beforeValidate()
    {
        if($this->isNewRecord){
            $this->createtime = $this->updatetime = new CDbExpression('NOW()');
            $this->createuserid = $this->updateuserid = Yii::app()->user->id;
        }
        else{
            $this->updatetime = new CDbExpression('NOW()');
            $this->updateuserid = Yii::app()->user->id;
        }
        
        return parent::beforeValidate();
    }
}

?>
